<?php 
	ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Terima Kasih [^_^]=b</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../css/main.css" media="all" />
<!--[if IE 6]><link type="text/css" rel="stylesheet" href="css/ie6.css" media="all" /><![endif]-->
<link rel="stylesheet" type="text/css" href="css/accordion_glam.css" />
<Script type="text/javascript">
window.history.forward(1);
</Script>
</head>
<body>
<?php
	$s=$_GET["sid"];
	require ("main_function.php"); 
	require ("header.php");
	
	$tm_lap="tpl/hasil.rtf";
	if(file_exists($tm_lap)){
		$target="tmp/LaporanHasil.rtf";
		if(file_exists($target)){
			unlink($target);
		}
		$r=fopen($tm_lap, "r+");
		$isi=fread($r, filesize($tm_lap));
		fclose($r);
			
		$query="select tsiswa.idSiswa,tsiswa.nmSis,tsiswa.asalSkol, tsiswa.jurusan,ttran_karak.tipe1,ttran_karak.tipe2,ttran_karak.tipe3,ttran_karak.tipe4, ";
		$query=$query."tbakat.tipe1,tbakat.tipe2,tbakat.tipe3,tbakat.tipe4 ";
		$query=$query."from ttran_karak inner join (tsiswa inner join tbakat on tsiswa.idSiswa=tbakat.kdBakat) ";
		$query=$query."on ttran_karak.idSiswa=tsiswa.idSiswa where tsiswa.idSiswa like '%".$s."%'";
		$result=mysql_query($query) or die("error Querynya= ".mysql_error());
		
		$dat=mysql_fetch_array($result);
		$isi =str_replace('nmsiswa', $dat[1],$isi);
		$isi =str_replace('asalskol', $dat[2],$isi);
		$isi =str_replace('jur', $dat[3],$isi);
		$isi =str_replace('Tip1', $dat[4],$isi);
		$isi =str_replace('Tip2', $dat[5],$isi);
		$isi =str_replace('Tip3', $dat[6],$isi);
		$isi =str_replace('Tip4', $dat[7],$isi);
		$isi =str_replace('Tipe1', $dat[8],$isi);
		$isi =str_replace('Tipe2', $dat[9],$isi);
		$isi =str_replace('Tipe3', $dat[10],$isi);
		$isi =str_replace('Tipe4', $dat[11],$isi);
		
		$r=fopen($target, "w+");
		fwrite($r,$isi);
		fclose($r);
		
		echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=0;URL=$target>";
		
	}
?>
<div id="test-accordion" class="accordion">
	<div id="isi">
	<table border="0" cellpadding="2" cellspacing="2" width="50%" id="tdall" align="center">
		<tr><td colspan="3" align="center" id="tdall" bgcolor="#5d5852"><b>Terima Kasih</b></td></tr>
		<tr>
			<td align="center">&nbsp;</td>
			<td>
			Terima Kasih anda telah berpartisipasi 
			<br /><br />
			untuk kembali melihat hasil yang lain klik <a href="lap.hasil.php">Disini</a>
			</td>
		</tr>
		<tr><td colspan="3" align="center" id="tdall" bgcolor="#5d5852"><b>Terima Kasih</b></td></tr>
	</table>

		</div>
		</div>
		</div>
		</div>
</body>
</html>
	<?php

	ob_end_flush();
	?>